package org.dlsu.pdfgen;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfPageEventHelper;
import com.itextpdf.text.pdf.PdfWriter;

public class HeaderAndFooter extends PdfPageEventHelper {
	
public HeaderAndFooter() {}

public void onEndPage(PdfWriter writer, Document document) {

PdfContentByte cb = writer.getDirectContent();
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT,
			new Phrase(String.format("Page %d", writer.getPageNumber()), new Font(Font.FontFamily.TIMES_ROMAN,
					12, Font.NORMAL)),
				document.right(),
				document.bottom()-20, 0);


}

}